package com.sgcc.ln.pmos.mobileapp.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sgcc.ln.pmos.common.listener.OnItemClickListener;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.ln.pmos.mobileapp.bean.GeographicregionBean;

public class ListAdapter extends BaseQuickAdapter<GeographicregionBean.DataBean, BaseViewHolder> {

    public ListAdapter() {
        super(R.layout.item_list);
    }

    private OnItemClickListener mOnItemClickListener;

    public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) {
        this.mOnItemClickListener = mOnItemClickListener;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, GeographicregionBean.DataBean bean) {
        baseViewHolder.setText(R.id.tv_name, bean.getGeogrRegionName());
        baseViewHolder.getView(R.id.ll_content).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mOnItemClickListener != null) {
                    mOnItemClickListener.onItemClick((GeographicregionBean.DataBean) bean, getItemPosition(bean));
                }
            }
        });
    }

}
